package com.runa.persistence.service;

import com.runa.monitor.comm.entity.CommMeter;
import com.runa.persistence.repository.CommMeterRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 2024/6/25 13:24
 * zhangYB
 */
@Slf4j
@Service
public class CommMeterService extends BatchService {

    @Resource
    private CommMeterRepository commMeterRepository;

    public List<CommMeter> getAllByIds(List<String> ids) {
        List<CommMeter> commMeters = new ArrayList<>();
        List<List<String>> subIdsList = getSubIdsList(ids);
        for (List<String> subIds : subIdsList) {
            List<CommMeter> subCommMeters = commMeterRepository.getAllByIds(subIds);
            commMeters.addAll(subCommMeters);
        }
        log.debug("分批查询表数量: {} 条, 结果: {} 条", ids.size(), commMeters.size());
        return commMeters;
    }






}
